home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / OLEVIEW.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  5KB  |  185 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1994, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.5  $
  6. //
  7. //----------------------------------------------------------------------------
  8. #if !defined(OWL_OLEVIEW_H)
  9. #define OWL_OLEVIEW_H
  10.  
  11. #if !defined(OWL_OLEWINDO_H)
  12. # include <owl/olewindo.h>
  13. #endif
  14. #if !defined(OWL_DOCVIEW_H)
  15. # include <owl/docview.h>
  16. #endif
  17. #if !defined(OWL_DOCMANAG_H)
  18. # include <owl/docmanag.h>
  19. #endif
  20.  
  21. #if defined(BI_NAMESPACE)
  22. namespace OWL {
  23. #endif
  24.  
  25. //
  26. // Additional notification messages
  27. //
  28. const int vnInvalidate  = 9;   // a rect in view needs repaint
  29. const int vnLinkView    = 10;  // find view with matched TOcLinkView
  30. const int vnLinkMoniker = 11;  // find view with matched moniker
  31.  
  32. NOTIFY_SIG(vnInvalidate, TRect&)
  33. NOTIFY_SIG(vnLinkView, TOcLinkView&)
  34. NOTIFY_SIG(vnLinkMoniker, TString&)
  35.  
  36. #define EV_VN_INVALIDATE  VN_DEFINE(vnInvalidate,  VnInvalidate,  long)
  37. #define EV_VN_LINKVIEW    VN_DEFINE(vnLinkView,    VnLinkView,    long)
  38. #define EV_VN_LINKMONIKER VN_DEFINE(vnLinkMoniker, VnLinkMoniker, long)
  39.  
  40. // Generic definitions/compiler options (eg. alignment) preceeding the
  41. // definition of classes
  42. #include <services/preclass.h>
  43.  
  44. //
  45. // class TOleView
  46. // ~~~~~ ~~~~~~~~
  47. // The ole 2 window view class. Used as a view in doc/view model
  48. //
  49. class _USERCLASS TOleView : public TOleWindow, public TView {
  50.   public:
  51.     TOleView(TDocument& doc, TWindow* parent = 0);
  52.    ~TOleView();
  53.  
  54.     static const char far* StaticName();
  55.  
  56.     // Inherited virtuals from TView
  57.     //
  58.     const char far* GetViewName();
  59.     TWindow* GetWindow();
  60.     bool     SetDocTitle(const char far* docname, int index);
  61.     bool     OleShutDown();
  62.  
  63.  
  64.     // Inherited virtuals from TWindow
  65.     //
  66.     bool CanClose();
  67.     void CleanupWindow();
  68.  
  69.   protected:
  70.     TOcView* CreateOcView(TRegLink* link, bool isEmbedded, IUnknown* outer);
  71.     bool OtherViewExists();
  72.  
  73.     // View notifications
  74.     //
  75.     bool VnInvalidate(TRect& rect);
  76.     bool VnDocOpened(int omode);
  77.     bool VnDocClosed(int omode);
  78.  
  79.     TMenuDescr* GetViewMenu();
  80.  
  81.     const char far* GetFileName();
  82.  
  83.     bool EvOcViewPartInvalid(TOcPartChangeInfo& changeInfo);
  84. //    uint32 EvOcViewDiscardUndo(void far* undo);
  85.  
  86.     // Container specific messages
  87.     //
  88. //    bool   EvOcAppInsMenus(TOcMenuDescr far&);
  89.  
  90.     // Server specific messages
  91.     //
  92.     bool   EvOcViewClose();
  93.     bool   EvOcViewSavePart(TOcSaveLoad far& ocSave);
  94.     bool   EvOcViewLoadPart(TOcSaveLoad far& ocLoad);
  95.     bool   EvOcViewOpenDoc(const char far* path);
  96.     bool   EvOcViewInsMenus(TOcMenuDescr far& sharedMenu);
  97.     bool   EvOcViewAttachWindow(bool attach);
  98.     bool   EvOcViewSetLink(TOcLinkView& view);
  99.     bool   EvOcViewBreakLink(TOcLinkView& view);
  100.     bool   EvOcViewGetItemName(TOcItemName& item);
  101.  
  102.   private:
  103.     bool   Destroying;
  104.  
  105.     // event handlers
  106.     //
  107.     bool     VnIsWindow(HWND hWnd);
  108.  
  109.   DECLARE_RESPONSE_TABLE(TOleView);
  110.   DECLARE_STREAMABLE(_OWLCLASS, TOleView,1);
  111. };
  112.  
  113. //
  114. // class TOleLinkView
  115. // ~~~~~ ~~~~~~~~~~~~
  116. class _DOCVIEWCLASS TOleLinkView : public TView {
  117.   public:
  118.     TOleLinkView(TDocument& doc, TOcLinkView& view);
  119.    ~TOleLinkView();
  120.  
  121.     virtual bool VnLinkView(TOcLinkView& view);
  122.     virtual bool VnLinkMoniker(TString& moniker);
  123.     virtual bool UpdateLinks();
  124.     TString& GetMoniker();
  125.  
  126.     static const char far* StaticName();
  127.     const char far* GetViewName();
  128.  
  129.   protected:
  130.     TOcLinkView&  OcLinkView;     // TOcLinkView partner for this view
  131.  
  132.   DECLARE_RESPONSE_TABLE(TOleLinkView);
  133. };
  134.  
  135. // Generic definitions/compiler options (eg. alignment) following the
  136. // definition of classes
  137. #include <services/posclass.h>
  138.  
  139. #if defined(BI_NAMESPACE)
  140. } // namespace OWL
  141. #endif
  142.  
  143. // --------------------------------------------------------------------------
  144. // Inline implementation
  145. //
  146.  
  147. //
  148. inline const char far* TOleView::StaticName() {
  149.   return "Ole View";
  150. }
  151.  
  152. //
  153. inline const char far* TOleView::GetViewName() {
  154.   return StaticName();
  155. }
  156.  
  157. //
  158. inline TWindow* TOleView::GetWindow() {
  159.   return (TWindow*)this;
  160. }
  161.  
  162. //
  163. inline bool TOleView::SetDocTitle(const char far* docname, int index) {
  164.   return TWindow::SetDocTitle(docname, index);
  165. }
  166.  
  167. //
  168. inline const char far* TOleView::GetFileName() {
  169.   return GetDocument().GetTitle();
  170. }
  171.  
  172. //
  173. inline const char far* TOleLinkView::StaticName() {
  174.   return "Link View";
  175. }
  176.  
  177. //
  178. inline const char far* TOleLinkView::GetViewName() {
  179.   return StaticName();
  180. }
  181.  
  182.  
  183.  
  184. #endif  // OWL_OLEVIEW_H
  185.